﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
using EFT;
using EFT.Interactive;
using System.Linq;

namespace ThrowUnknownEx_view
{
    public class Main : MonoBehaviour
    {
        public Main() { }

        private GameObject GameObjectHolder;

        private IEnumerable<Player> _playerInfo;
        private IEnumerable<ExfiltrationPoint> _extract;
        private IEnumerable<LootableContainer> _containers;
        private IEnumerable<LootItem> _item;

        private float _playNextUpdateTime;
        private float _extNextUpdateTime;
        protected float _infoUpdateInterval = 10f;


        private bool _isInfoMenuActive;
        private bool _pInfor;
        private bool _pBoxr;
        private bool _pVidr;
        private bool _pBonesr;
        private bool _fbright;
        private bool _showLines;
        private bool _showWeapons;
        private bool _showBodies;
        private bool _showExtractInfo;
        private bool _showItems;
        private bool _showContainers;

        private double _lowDist = 250.00; // Default distance to midscreen
        private int _AimSpeed = 1; // Default speed = high speed for aimbot (higher value = smoother)
        private bool _smooth = true;
        private bool _aim;
        private float _ContainerDistance = 50f;
        private float _lootItemDistance = 50f;
        private float _weaponBoxesNextUpdateTime;
        private float _itemsNextUpdateTime;
        private float _espUpdateInterval = 500f;
        private float _viewdistance = 650f;


        [DllImport("user32.dll")]
        static extern bool GetCursorPos(out POINT lpPoint);
        [DllImport("user32.dll")]
        static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
        private const int MOUSEEVENTF_MOVE = 0x0001;
        public static void Move(int xDelta, int yDelta)
        {
            mouse_event(MOUSEEVENTF_MOVE, xDelta, yDelta, 0, 0);
        }
        public struct POINT
        {
            public int X;
            public int Y;
        }



        public void Load()
        {
            GameObjectHolder = new GameObject();
            GameObjectHolder.AddComponent<Main>();
            DontDestroyOnLoad(GameObjectHolder);
        }

        public void Unload()
        {
            Destroy(GameObjectHolder);
            Destroy(this);
        }

        private void Update()
        {
            if (Input.GetKeyDown(KeyCode.F11))
            {
                _isInfoMenuActive = !_isInfoMenuActive;
            }
            if (Input.GetKeyDown(KeyCode.Mouse3)) // You can change it or create a GUI for change it in game
            {
                _aim = !_aim;
            }

            if (_fbright)
            {

                Vector3 playerPos = new Vector3(
                    localplayer.Transform.position.x,
                    localplayer.Transform.position.y + 1,
                    localplayer.Transform.position.z);
                lightGameObject.transform.position = playerPos;
                FullBrightLight.range = 1000;
            }
            else
            {
                GameObject.Destroy(FullBrightLight);
                lightCalled = false;
            }

        }


        public GameObject lightGameObject;
        public Light FullBrightLight;

        public bool _LightEnabled = true;
        public bool _LightCreated;
        public bool lightCalled;

        private void OnGUI()
        {
            if (_isInfoMenuActive)
            {
                GUIOverlay();
            }




            if (_aim)
            {

                GUI.Label(new Rect(10f, 10f, 200f, 20f), "Ketaminehook uwu [AIM: ON]");
            }
            else
            {
                GUI.Label(new Rect(10f, 10f, 200f, 20f), "Ketaminehook uwu");
            }

            if (localplayer != null)
            {
                GUI.Label(new Rect(10f, 30f, 200f, 20f), localplayer.HealthController.GetBodyPartHealth(EFT.HealthSystem.EBodyPart.Common).Current.ToString());
            }

            if ((_pInfor && Time.time >= _playNextUpdateTime) || (_aim && Time.time >= _playNextUpdateTime))
            {
                _playerInfo = FindObjectsOfType<Player>();
                _playNextUpdateTime = Time.time + _infoUpdateInterval;
            }

            if (_aim)
                Aimbot_Method();
            // Aimbot();

            if (_pInfor)
            {
                DrawPlayers();
            }





            if (_showExtractInfo && Time.time >= _extNextUpdateTime)
            {
                if (Time.time >= _extNextUpdateTime)
                {
                    _extract = FindObjectsOfType<ExfiltrationPoint>();
                    _extNextUpdateTime = Time.time + _infoUpdateInterval;
                }
                DrawExtractInfo();
            }

            if (_showContainers)
            {
                if (Time.time >= _weaponBoxesNextUpdateTime)
                {
                    _containers = UnityEngine.Object.FindObjectsOfType<LootableContainer>();
                    _weaponBoxesNextUpdateTime = Time.time + _espUpdateInterval;
                }
                DrawWeaponBoxesContainers();
            }


            if (_showItems)
            {
                if (Time.time >= _itemsNextUpdateTime)
                {
                    _item = FindObjectsOfType<LootItem>();
                    _itemsNextUpdateTime = Time.time + _espUpdateInterval;
                }
                ShowItemESP();
            }


            if (_fbright)
            {
                Fullbright();
            }
        }

        private void Fullbright()
        {
            if (!lightCalled)
            {
                lightGameObject = new GameObject("Fullbright");
                FullBrightLight = lightGameObject.AddComponent<Light>();
                FullBrightLight.color = new Color(1f, 1f, 0.7f, 0.5f);
                lightCalled = true;
            }
        }

        private void Aimbot()
        {
            int aimPosX = 0;
            int aimPosY = 0;
            foreach (var player in _playerInfo)
            {
                float distanceToObject = Vector3.Distance(Camera.main.transform.position, player.Transform.position);

                if (player.GroupId != localgroup || localgroup == "" || localgroup == "0" || localgroup == null)
                {


                    if (distanceToObject < 200)
                    {
                        if (player.HealthController.IsAlive && player.IsVisible && EPointOfView.FirstPerson != player.PointOfView)
                        {

                            var playerHeadVector = new Vector2(
                                Camera.main.WorldToScreenPoint(player.PlayerBones.Head.position).x,
                                Camera.main.WorldToScreenPoint(player.PlayerBones.Head.position).y);
                            double distance = GetDistance(Screen.width / 2, Screen.height / 2, playerHeadVector.x, playerHeadVector.y);

                            if (distance < _lowDist)
                            {
                                aimPosX = (int)playerHeadVector.x;
                                aimPosY = (int)playerHeadVector.y;
                            }
                        }
                    }
                }
            }
            AimAtPos(aimPosX, aimPosY);
            //Circle((Screen.width / 2), (Screen.height / 2), (int)_lowDist);
        }

        // From a member of the CS GO section not by me but i've modified some thing for EFT
        private void AimAtPos(int x, int y)
        {
            int ScreenCenterX = (Screen.width / 2);
            int ScreenCenterY = (Screen.height / 2);
            float TargetX = 0;
            float TargetY = 0;
            if (x != 0 && x != ScreenCenterX)
            {
                if (x > ScreenCenterX)
                {
                    TargetX = -(ScreenCenterX - x);
                    if (TargetX + ScreenCenterX > ScreenCenterX * 2) TargetX = 0;
                }

                if (x < ScreenCenterX)
                {
                    TargetX = x - ScreenCenterX;
                    if (TargetX + ScreenCenterX < 0) TargetX = 0;
                }
            }
            if (y != 0 && y != ScreenCenterY)
            {
                if (y > ScreenCenterY)
                {
                    TargetY = ScreenCenterY - y;
                    if (TargetY + ScreenCenterY > ScreenCenterY * 2) TargetY = 0;
                }

                if (y < ScreenCenterY)
                {
                    TargetY = -(y - ScreenCenterY);
                    if (TargetY + ScreenCenterY < 0) TargetY = 0;
                }
            }
            if (!_smooth)
            {
                Move((int)TargetX, (int)TargetY);
                return;
            }
            TargetX /= _AimSpeed;
            TargetY /= _AimSpeed;
            if (Math.Abs(TargetX) < 1)
            {
                if (TargetX > 0)
                {
                    TargetX = 1;
                }
                if (TargetX < 0)
                {
                    TargetX = -1;
                }
            }
            if (Math.Abs(TargetY) < 1)
            {
                if (TargetY > 0)
                {
                    TargetY = 1;
                }
                if (TargetY < 0)
                {
                    TargetY = -1;
                }
            }
            Move((int)TargetX, (int)TargetY);
        }


        #region vangle_aim

        public void Aimbot_Method()
        {
            foreach (Player player in _playerInfo)
            {
                if (!(player == null) && !(player == localplayer) && player.HealthController != null && player.HealthController.IsAlive)
                {
                    if (player.GroupId != localgroup || localgroup == "" || localgroup == "0" || localgroup == null)
                    {
                        Vector3 vector = getBonePos(player);
                        if (!(vector == Vector3.zero) && CalcInFov(vector) <= 10 /* FOV AIM*/ && IsVisible(player.gameObject, getBonePos(player)))
                        {
                            AimAtPos(vector);
                        }
                    }
                }
            }
        }

        private bool IsVisible(GameObject obj, Vector3 Position)
        {
            RaycastHit raycastHit;
            return Physics.Linecast(GetShootPos(), Position, out raycastHit) && raycastHit.collider && raycastHit.collider.gameObject.transform.root.gameObject == obj.transform.root.gameObject;
        }

        public Vector3 GetShootPos()
        {
            if (localplayer == null)
            {
                return Vector3.zero;
            }
            Player.FirearmController firearmController = localplayer.HandsController as Player.FirearmController;
            if (firearmController == null)
            {
                return Vector3.zero;
            }
            return firearmController.Fireport.position + Camera.main.transform.forward * 1f;
        }

      



        public enum ibid
        {
            Head,
            Neck,
            Chest,
            Stomach
        }

        public int idtobid(ibid bid)
        {
            switch (bid)
            {
                case ibid.Neck:
                    return 132;

                case ibid.Chest:
                    return 36;

                case ibid.Stomach:
                    return 29;

                default:
                    return 133;
            }
        }

        public Vector3 getBonePos(Player inP)
        {
            int bid = idtobid(ibid.Neck);
            return this.GetBonePosByID(inP, bid);
        }

        public static float CalcInFov(Vector3 Position)
        {
            Vector3 position = Camera.main.transform.position;
            Vector3 forward = Camera.main.transform.forward;
            Vector3 normalized = (Position - position).normalized;
            return Mathf.Acos(Mathf.Clamp(Vector3.Dot(forward, normalized), -1f, 1f)) * 57.29578f;
        }

        public void AimAtPos(Vector3 pos)
        {
            Vector2 rotation = localplayer.MovementContext.Rotation;
            Vector3 b = GetShootPos();
            Vector3 eulerAngles = Quaternion.LookRotation((pos - b).normalized).eulerAngles;
            if (eulerAngles.x > 180f)
            {
                eulerAngles.x -= 360f;
            }
            localplayer.MovementContext.Rotation = new Vector2(eulerAngles.y, eulerAngles.x);
        }

        #endregion

        private void DrawExtractInfo()
        {
            foreach (var point in _extract)
            {
                if (point.isActiveAndEnabled)
                {
                    float distanceToObject = Vector3.Distance(Camera.main.transform.position, point.transform.position);
                    var exfilContainerBoundingVector = new Vector3(
                        Camera.main.WorldToScreenPoint(point.transform.position).x,
                        Camera.main.WorldToScreenPoint(point.transform.position).y,
                        Camera.main.WorldToScreenPoint(point.transform.position).z);
                    if (exfilContainerBoundingVector.z > 0.01)
                    {
                        GUI.color = Color.green;
                        int distance = (int)distanceToObject;
                        String exfilName = point.name;
                        string boxText = $"{exfilName} - {distance}m";
                        GUI.Label(new Rect(exfilContainerBoundingVector.x - 50f, (float)Screen.height - exfilContainerBoundingVector.y, 100f, 50f), boxText);
                    }
                }
            }
        }

        private void DrawWeaponBoxesContainers()
        {
            foreach (var contain in _containers)
            {
                float distance = Vector3.Distance(Camera.main.transform.position, contain.transform.position);
                if (contain != null && distance < _ContainerDistance)
                {
                    var containBoundingVector = new Vector3(
                        Camera.main.WorldToScreenPoint(contain.transform.position).x,
                        Camera.main.WorldToScreenPoint(contain.transform.position).y,
                        Camera.main.WorldToScreenPoint(contain.transform.position).z);
                    if (containBoundingVector.z > 0.01)
                    {
                        GUI.color = Color.cyan;
                        String contain_name = contain.name;
                        string boxText = $"{contain_name} - [{distance}]m";
                        GUI.Label(new Rect(containBoundingVector.x - 50f, (float)Screen.height - containBoundingVector.y, 100f, 50f), boxText);
                    }
                }
            }
        }

        private void ShowItemESP()
        {
            foreach (var Item in _item)
            {
                if (Item == null)
                    continue;

                float distance = Vector3.Distance(Camera.main.transform.position, Item.transform.position);
                Vector3 ItemBoundingVector = new Vector3(Camera.main.WorldToScreenPoint(Item.transform.position).x, Camera.main.WorldToScreenPoint(Item.transform.position).y, Camera.main.WorldToScreenPoint(Item.transform.position).z);
                if (ItemBoundingVector.z > 0.01 && Item != null && (Item.name.Contains("key") || Item.name.Contains("30x160mm") || Item.name.Contains("usb") || Item.name.Contains("alkali") || Item.name.Contains("ophalmo") || Item.name.Contains("gunpowder") || Item.name.Contains("phone") || Item.name.Contains("gas") || Item.name.Contains("money") || Item.name.Contains("document") || Item.name.Contains("quest") || Item.name.Contains("spark") || Item.name.Contains("grizzly") || Item.name.Contains("sv-98") || Item.name.Contains("sv98") || Item.name.Contains("rsas") || Item.name.Contains("salewa") || Item.name.Equals("bitcoin") || Item.name.Contains("dvl") || Item.name.Contains("m4a1") || Item.name.Contains("roler") || Item.name.Contains("chain") || Item.name.Contains("wallet") || Item.name.Contains("RSASS") || Item.name.Contains("glock") || Item.name.Contains("SA-58")) && distance <= _lootItemDistance)
                {
                    name = Item.name;

                    string text = string.Format($"{Item.name} - [{distance}]m");
                    GUI.color = Color.magenta;
                    GUI.Label(new Rect(ItemBoundingVector.x - 50f, (float)Screen.height - ItemBoundingVector.y, 100f, 50f), text);
                }
            }
        }

        Player localplayer;
        string localgroup;





        public static Vector3 SkeletonBonePos(Diz.Skinning.Skeleton sko, int id)
        {
            return sko.Bones.ElementAt(id).Value.position;
        }

        public Vector3 GetBonePosByID(Player p, int id)
        {
            Vector3 result;
            try
            {
                result = SkeletonBonePos(p.PlayerBones.AnimatedTransform.Original.gameObject.GetComponent<PlayerBody>().SkeletonRootJoint, id);
            }
            catch (Exception)
            {
                result = Vector3.zero;
            }
            return result;
        }
        private void DrawPlayers()
        {
            foreach (var player in _playerInfo)
            {
                float distanceToObject = Vector3.Distance(Camera.main.transform.position, player.Transform.position);
                Vector3 playerBoundingVector = Camera.main.WorldToScreenPoint(player.Transform.position);


                if (player.PointOfView == EPointOfView.FirstPerson)
                {
                    localplayer = player;
                    if (player.GroupId != "")
                    {
                        localgroup = player.GroupId;
                    }

                }



                if (distanceToObject <= _viewdistance && playerBoundingVector.z > 0.01 && (localplayer != player))
                {

                    var playerHeadVector = new Vector3(
                    Camera.main.WorldToScreenPoint(player.PlayerBones.Head.position).x,
                    Camera.main.WorldToScreenPoint(player.PlayerBones.Head.position).y,
                    Camera.main.WorldToScreenPoint(player.PlayerBones.Head.position).z);

                    float boxVectorX = Camera.main.WorldToScreenPoint(player.Transform.position).x;
                    float boxVectorY = Camera.main.WorldToScreenPoint(player.PlayerBones.Head.position).y + 10f;
                    float boxHeight = Math.Abs(Camera.main.WorldToScreenPoint(player.PlayerBones.Head.position).y - Camera.main.WorldToScreenPoint(player.Transform.position).y) + 10f;
                    float boxWidth = boxHeight * 0.65f;
                    var IsAI = player.Profile.Info.RegistrationDate <= 0;
                    var playerColor = player.HealthController.IsAlive ? GetPlayerColor(player.Side) : Color.gray;

                    if (player.GroupId == localgroup && localgroup != "0" && player.GroupId != "" && player.GroupId != null)
                    {
                        playerColor = Color.green;
                    }

                    var playerName = player.IsAI ? "AI" : player.Profile.Info.Nickname;

                    if (player.Profile.Info.RegistrationDate <= 0)
                    {
                        if (player.Side == EPlayerSide.Savage)
                        {
                            playerColor = Color.white;
                        }
                    }





                    var playerHealth = player.HealthController.GetBodyPartHealth(EFT.HealthSystem.EBodyPart.Common).Current;
                    if (player.HealthController.IsAlive && _pBoxr && player != localplayer)
                    {
                        Utility.DrawBox(boxVectorX - boxWidth / 2f, (float)Screen.height - boxVectorY, boxWidth, boxHeight, playerColor);

                        if (!_pBonesr)
                        {
                            Utility.DrawLine(new Vector2(playerHeadVector.x - 2f, (float)Screen.height - playerHeadVector.y), new Vector2(playerHeadVector.x + 2f, (float)Screen.height - playerHeadVector.y), playerColor);
                            Utility.DrawLine(new Vector2(playerHeadVector.x, (float)Screen.height - playerHeadVector.y - 2f), new Vector2(playerHeadVector.x, (float)Screen.height - playerHeadVector.y + 2f), playerColor);
                        }
                    }

                    if (player.HealthController.IsAlive && _pBonesr && player != localplayer)
                    {

                        if (distanceToObject < 100)
                        {
                            var pRPVect =
                    Camera.main.WorldToScreenPoint(player.PlayerBones.RightPalm.position);
                            var PLPVect =
                                Camera.main.WorldToScreenPoint(player.PlayerBones.LeftPalm.position);
                            var PLShVect =
                                Camera.main.WorldToScreenPoint(player.PlayerBones.LeftShoulder.position);
                            var PLRShVect =
                                Camera.main.WorldToScreenPoint(player.PlayerBones.RightShoulder.position);
                            var PLNeckVect =
                                Camera.main.WorldToScreenPoint(player.PlayerBones.Neck.position);
                            var PLCentrVect =
                                Camera.main.WorldToScreenPoint(player.PlayerBones.Pelvis.position);
                            var PLRTighVect =
                                Camera.main.WorldToScreenPoint(player.PlayerBones.RightThigh2.position);
                            var PLLTighVect =
                                Camera.main.WorldToScreenPoint(player.PlayerBones.LeftThigh2.position);
                            var PLRFootVect =
                                Camera.main.WorldToScreenPoint(player.PlayerBones.KickingFoot.position);
                            var PLLFootVect =
                                Camera.main.WorldToScreenPoint(GetBonePosByID(player, 18)
                                );
                            var PLLBowVect =
                                Camera.main.WorldToScreenPoint(GetBonePosByID(player, 91)
                                );
                            var PLRBowVect =
                                Camera.main.WorldToScreenPoint(GetBonePosByID(player, 112)
                                );
                            var PLLKneeVect =
                                Camera.main.WorldToScreenPoint(GetBonePosByID(player, 17)
                                );
                            var PLRKneeVect = Camera.main.WorldToScreenPoint(GetBonePosByID(player, 22));




                            Utility.DrawLine(new Vector2(PLNeckVect.x, (float)Screen.height - PLNeckVect.y), new Vector2(PLCentrVect.x, (float)Screen.height - PLCentrVect.y), playerColor);
                            Utility.DrawLine(new Vector2(PLShVect.x, (float)Screen.height - PLShVect.y), new Vector2(PLLBowVect.x, (float)Screen.height - PLLBowVect.y), playerColor);
                            Utility.DrawLine(new Vector2(PLRShVect.x, (float)Screen.height - PLRShVect.y), new Vector2(PLRBowVect.x, (float)Screen.height - PLRBowVect.y), playerColor);
                            Utility.DrawLine(new Vector2(PLLBowVect.x, (float)Screen.height - PLLBowVect.y), new Vector2(PLPVect.x, (float)Screen.height - PLPVect.y), playerColor);
                            Utility.DrawLine(new Vector2(PLRBowVect.x, (float)Screen.height - PLRBowVect.y), new Vector2(pRPVect.x, (float)Screen.height - pRPVect.y), playerColor);
                            Utility.DrawLine(new Vector2(PLRShVect.x, (float)Screen.height - PLRShVect.y), new Vector2(PLShVect.x, (float)Screen.height - PLShVect.y), playerColor);
                            Utility.DrawLine(new Vector2(PLLKneeVect.x, (float)Screen.height - PLLKneeVect.y), new Vector2(PLCentrVect.x, (float)Screen.height - PLCentrVect.y), playerColor);
                            Utility.DrawLine(new Vector2(PLRKneeVect.x, (float)Screen.height - PLRKneeVect.y), new Vector2(PLCentrVect.x, (float)Screen.height - PLCentrVect.y), playerColor);
                            Utility.DrawLine(new Vector2(PLLKneeVect.x, (float)Screen.height - PLLKneeVect.y), new Vector2(PLLFootVect.x, (float)Screen.height - PLLFootVect.y), playerColor);
                            Utility.DrawLine(new Vector2(PLRKneeVect.x, (float)Screen.height - PLRKneeVect.y), new Vector2(PLRFootVect.x, (float)Screen.height - PLRFootVect.y), playerColor);
                        }
                        else
                        {
                            Utility.DrawLine(new Vector2(playerHeadVector.x - 2f, (float)Screen.height - playerHeadVector.y), new Vector2(playerHeadVector.x + 2f, (float)Screen.height - playerHeadVector.y), playerColor);
                            Utility.DrawLine(new Vector2(playerHeadVector.x, (float)Screen.height - playerHeadVector.y - 2f), new Vector2(playerHeadVector.x, (float)Screen.height - playerHeadVector.y + 2f), playerColor);
                        }



                    }

                    if (_pVidr && playerName != "AI")
                    {
                        playerName = "Plr";
                    }

                    string WeaponName;
                    try
                    {
                        WeaponName = player.Weapon.ShortName.Localized();
                    }
                    catch (Exception e)
                    {

                        WeaponName = ".";
                    }



                    //  var playerHealth = player.HealthController.GetBodyPartHealth(EFT.HealthSystem.EBodyPart.Common).Current;
                    string playerText = player.HealthController.IsAlive ? playerName : (playerName + " (Dead)");
                    string playerTextDraw = string.Format("{0} [{1}]-{2}", playerText, (int)distanceToObject, playerHealth);
                    var playerTextVector = GUI.skin.GetStyle(playerText).CalcSize(new GUIContent(playerText));

                    if (_showBodies && !player.HealthController.IsAlive)
                    {
                        GUI.Label(new Rect(playerBoundingVector.x - playerTextVector.x / 2f, (float)Screen.height - boxVectorY - 20f, 300f, 50f), playerTextDraw);


                    }
                    else if (player.HealthController.IsAlive)
                    {

                        if (_showLines && player != localplayer)
                        {
                            Vector3 w2s = Camera.main.WorldToScreenPoint(player.PlayerBones.RootJoint.position);
                            if (w2s.z < 0.01f)
                            {
                            }
                            else
                            {
                                Utility.DrawLine(new Vector2((Screen.width / 2), Screen.height), new Vector2(w2s.x, Screen.height - w2s.y), playerColor);
                            }

                        }

                        if (_showWeapons)
                        {
                            GUI.Label(new Rect(playerBoundingVector.x - playerTextVector.x / 2f, (float)Screen.height - boxVectorY - 33f, 300f, 50f), WeaponName);
                        }

                        GUI.Label(new Rect(playerBoundingVector.x - playerTextVector.x / 2f, (float)Screen.height - boxVectorY - 20f, 300f, 50f), playerTextDraw);
                    }
                    /*
                    else if (!_showBodies && !player.HealthController.IsAlive)
                    {
                        //chill;
                    }
                    **/



                    //var playerWeapon = player.Weapon.ShortName;
                    // GUI.Label(new Rect(playerBoundingVector.x - playerTextVector.x / 2f, (float)Screen.height - boxVectorY - 40f, 300f, 50f), playerWeapon);


                }
            }
        }


        private Color GetPlayerColor(EPlayerSide side)
        {
            switch (side)
            {
                case EPlayerSide.Bear:
                    return Color.red;
                case EPlayerSide.Usec:
                    return Color.blue;
                case EPlayerSide.Savage:
                    return Color.yellow;
                default:
                    return Color.white;
                    /*
                    case EPlayerSide.Bear:
                        return ColorUtility.TryParseHtmlString(_bearColor);
                    case EPlayerSide.Usec:
                        return ColorUtility.TryParseHtmlString(_usecColor);
                    case EPlayerSide.Savage:
                        return ColorUtility.TryParseHtmlString(_scavColor);
                    default:
                        return Color.white;
                        */
            }
        }

        private void GUIOverlay()
        {
            GUI.color = Color.gray;
            GUI.Box(new Rect(100f, 100f, 400f, 500f), "");
            GUI.color = Color.white;
            GUI.Label(new Rect(180f, 110f, 120f, 20f), "TransRights by Stingray#4564");
            _pInfor = GUI.Toggle(new Rect(110f, 140f, 120f, 20f), _pInfor, "Players ESP"); // Display player
            _showLines = GUI.Toggle(new Rect(110f, 160f, 120f, 20f), _showLines, "SnapLines"); //Display  extraction
            _aim = GUI.Toggle(new Rect(110f, 180f, 120f, 20f), _aim, "Aimbot"); //Display  aimbot
            if (_aim)
            {
                GUI.Label(new Rect(110f, 200f, 150f, 20f), "AIM Center distance");
                _lowDist = (GUI.HorizontalSlider(new Rect(220f, 200f, 120f, 20f), (float)_lowDist, 20.0F, 1000.0F)); //Player distance on the mid screen to aim
            }
            _smooth = GUI.Toggle(new Rect(110f, 220f, 120f, 20f), _smooth, "Smooth aim");
            if (_smooth)
            {
                GUI.Label(new Rect(110f, 240f, 150f, 20f), "Speed smoothing");
                _AimSpeed = (int)(GUI.HorizontalSlider(new Rect(220f, 240f, 120f, 20f), _AimSpeed, 1.0F, 100.0F)); //Display  aimspeed (more great value = smoother aim)

            }
            GUI.Label(new Rect(110f, 260f, 150f, 20f), "ESP Distance");
            _viewdistance = GUI.HorizontalSlider(new Rect(220f, 260f, 120f, 20f), _viewdistance, 0.0F, 1500.0F); // Distance of players ESP
            _showItems = GUI.Toggle(new Rect(110f, 280f, 120f, 20f), _showItems, "Show Items"); //Show items on map
            if (_showItems)
            {
                GUI.Label(new Rect(110f, 320f, 150f, 20f), "Items Distance");
                _lootItemDistance = GUI.HorizontalSlider(new Rect(210f, 300f, 120f, 20f), _lootItemDistance, 10.0F, 1500.0F);
            }
            _pBoxr = GUI.Toggle(new Rect(110f, 340f, 120f, 20f), _pBoxr, "Player Boxes"); // Show containers on map

            _showContainers = GUI.Toggle(new Rect(110f, 360f, 120f, 20f), _showContainers, "Show Containers"); // Show containers on map
            if (_showContainers)
            {
                GUI.Label(new Rect(110f, 380f, 150f, 20f), "Containers Distance");
                _ContainerDistance = GUI.HorizontalSlider(new Rect(210f, 360f, 120f, 20f), _ContainerDistance, 10.0F, 1500.0F);
            }

            _showBodies = GUI.Toggle(new Rect(110f, 400f, 120f, 20f), _showBodies, "Show Bodies");

            _fbright = GUI.Toggle(new Rect(110f, 420f, 120f, 20f), _fbright, "Fullbright mode");
            _pBonesr = GUI.Toggle(new Rect(110f, 440f, 120f, 20f), _pBonesr, "Draw bones ESP (test)");
            _pVidr = GUI.Toggle(new Rect(110f, 460f, 120f, 20f), _pVidr, "Video Mode");
            _showWeapons = GUI.Toggle(new Rect(110f, 480f, 120f, 20f), _showWeapons, "Show Weapons");
        }

        private double GetDistance(double x1, double y1, double x2, double y2)
        {
            return Math.Sqrt(Math.Pow(x2 - x1, 2.0) + Math.Pow(y2 - y1, 2.0));
        }

        private void Circle(int X, int Y, int radius)
        {
            float boxXOffset = X;
            float boxYOffset = Y;
            float boxHeight = radius;
            float boxwidth = radius;
            Utility.DrawBox(boxXOffset - (radius / 2), boxYOffset - (radius / 2), radius, radius, Color.yellow);
            Utility.DrawLine(new Vector2(960, 1080), new Vector2(960, 0), Color.white);
            Utility.DrawLine(new Vector2(0, 540), new Vector2(1920, 540), Color.white);
        }
    }
}